Suspension and reinstatement of reference handles

ABSTRACT

A handle administration system is described in which software agents receive handles to various resources that they can use to obtain the resources. The described embodiments provide multiple states that can be assumed by the handles. An unassigned state is provided in which handles are not assigned to a particular resource, nor can they be dereferenced to obtain pointers to any resources. An assigned state is provided in which handles are assigned to a particular resource and can be dereferenced to obtain a pointer to the resource. A suspended state is provided in which the handles are assigned to a particular resource but cannot be dereferenced to obtain a pointer to that resource. Advantageously, a suspended handle can be reinstated to assume the assigned state. In one embodiment, the handle system is implemented by incorporating a suitable field in a handle database that is used to indicate that a handle is suspended. In another embodiment, no additional fields are necessary. Rather, handle values in the handle database are manipulated to indicate that a handle has been suspended. These manipulations can be easily undone to reinstate a handle. In the described embodiment, a three state handle system can be advantageously employed to implement a two-phase commit operation.

RELATED APPLICATIONS

This application is a divisional of and claims priority to U.S. patentapplication Ser. No. 09/608,341, filed Jun. 29, 2000 the disclosure ofwhich is incorporated by reference herein.

TECHNICAL FIELD

This invention relates to handle administration systems and methods, andparticularly to handle administration systems in which reference handlesare used to access resources that are managed by a resource manager.

BACKGROUND

It is not uncommon for software modules operating on computer systems torequire access to shared resources. For example, a given computerprogram may require access to files maintained by a file system, or itmay require access to network connections maintained by a networkdriver. Network drivers may require access to information structuresmaintained by a network packet classifier. This is a complex arrangementthat includes numerous software modules, such as software driversrequiring access to many shared resources and an access supervisor thateither maintains the resources or at least intercedes when a softwaremodule attempts to access a resource.

Intercession by an access supervisor is important for several reasons.One especially important reason is associated with a situation when asoftware module deletes a resource. Specifically, if a first softwaremodule deletes a resource, then other software modules that maintaindirect pointers to the resource will be unable to access or use theresource. This is because their pointers will no longer point to a validresource. Attempts have been made to solve this problem by notifyingsoftware modules when a resource deletion occurs. However, this requiresdetailed accounting and tracking of software modules and theirrespective pointers to the resources. As a result, this process isextremely expensive and very complex.

Another attempt to solve this problem involves having an accesssupervisor intercede when a software module requires access to aparticular resource. Interceding ensures that the particular resourcestill exists before the software module is granted access to theparticular resource. Typically, this is accomplished by having theaccess supervisor, through a handle administrator, issue a handle toeach software module for a particular resource instead of allowing eachsoftware module a direct pointer to that particular resource. The handleis associated with the resource and is used to refer to the particularresource when it is desired to be used by the software module. Thesoftware module does not use the handle to directly access the resource.Rather, the software module presents the handle to the accesssupervisor, which can then use the handle to obtain a pointer to theresource for that software module. The process of converting a handlefor a resource into a pointer to that resource is known asdereferencing.

Handle administration systems are typically characterized by havinghandles that can assume one of two states—an assigned state and anunassigned state. When a handle is in the assigned state, the handleadministrator has associated that handle with both a resource and apointer to the resource. The handle can then be used by software modulesany time they want to obtain a pointer to the resource. To obtain apointer to a resource, the software modules simply present the handle tothe access supervisor which then checks to determine whether the handleis valid. If the handle is valid, then the associated pointer to theresource can be returned to the software module. If the handle is notvalid, then an appropriate notification to the software module can begenerated. When a handle is in the unassigned state, it is notassociated with any resource and thus cannot be used to access aresource. An assigned handle becomes unassigned when it is “released”. Ahandle can be released when the resource with which it is associated isremoved or is no longer available for use by the software modules.Releasing a handle means that the handle can no longer be used to accessthe resource with which it was formerly associated. Once a handle isreleased, it is available to be associated with another resource andthereby returned to the assigned state.

It would be very desirable, in some situations, to have the ability totentatively release a handle. Such a tentatively released handle isstill associated with a resource, but it is not considered valid, so itcannot be dereferenced to obtain a pointer to the associated resource.Because the tentatively released handle is not fully released, it is notavailable to be associated with another resource. This tentativelyreleased handle could then be permanently released into an unassignedstate, thus making it available for assignment to another resource, orit could be reinstated into an assigned state that maintains itsassociation with the resource with which it has already been assigned.Presently, however, there are no known handle administration systemsthat allow this kind of operation.

Accordingly, this invention arose out of concerns associated withimproving handle administration systems and methods.

SUMMARY

A handle administration system is described in which software agentsreceive handles to various resources. The illustrated and describedembodiments provide multiple states that can be assumed by the handles.An unassigned state is provided in which handles are not assigned to aparticular resource, nor can they be dereferenced into pointers to anyresources. In the unassigned state, the handles are available forassignment to particular resources. An assigned state is provided inwhich handles are assigned to a particular resource and can bedereferenced to obtain a pointer to the resource. A suspended state isprovided in which the handles are assigned to a particular resource butcannot be dereferenced to obtain a pointer to that resource.Advantageously, a suspended handle can be reinstated to assume theassigned state.

In the described embodiment, there are four actions that can causetransition between the multiple states. From the unassigned state, ahandle can be assigned so that it assumes the assigned state. When inthe assigned state, a handle can be released so that it assumes theunassigned state. Additionally, when in the assigned state, a handle canbe suspended so that it assumes the suspended state. Once in thesuspended state, a handle can be reinstated so that it assumes theassigned state. Additionally, in the suspended state, a handle can bereleased so that it assumes the unassigned state.

Having the suspended state advantageously enables certain operations tobe conducted which, in previous handle systems were impossible toimplement. An exemplary operation is a two-phase commit. In a two phasecommit operation, two or more agents are each asked to suspend a handleassociated with a particular resource (phase 1). If all of the agentscan successfully suspend their handles, then all of the handles arereleased (phase 2). If any agent is unable to suspend its handle, all ofthe handles are reinstated so that they assume the assigned state.

In one embodiment, a three state handle system is implemented byincorporating a suitable field in a handle database that is used tomanage the handles. The incorporated field can be a flag that is set toindicate that a particular handle has been suspended. In anotherembodiment, no additional database fields are necessary to implement thethree state handle system. Here, a handle database includes a field forhandle values. The handle value is the value that is given to an agentwhen it desires access to a resource. In this embodiment, when a handleis suspended, a value is added to the handle value to yield a resultantvalue. When an agent presents the original handle value to access thehandle's associated resource, the handle administrator can check thevalidity of the presented handle value by comparing it against theresultant handle value. Since the two compared handle values do notmatch, the handle is treated as an invalid handle. To reinstate a handlefrom the suspended state into the assigned state, the value that wasoriginally added to the handle value is subtracted from the handle valueto yield the original handle value. Now, when an agent presents thehandle value it will compare favorably and thus be appropriately treatedas a valid handle.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is an exemplary computer system that is suitable for implementingthe embodiments discussed below.

FIG. 2 is a high level block diagram of an exemplary handleadministration system in accordance with the described embodiments.

FIG. 3 is a state diagram that describes three exemplary states thathandles can assume in a handle administration system in accordance withthe described embodiment.

FIG. 4 is a flow diagram that describes steps in a method in accordancewith the described embodiment.

FIG. 5 is a diagram that illustrates a handle record in accordance withone embodiment.

FIG. 6 is a diagram of a handle database that is used in a handleadministration system in accordance with the FIG. 5 handle record.

FIG. 7 is a flow diagram that describes steps in a method in accordancewith the described embodiment.

FIG. 8 is a diagram of a handle database in accordance with oneembodiment.

FIG. 9 is a flow diagram that describes steps in a suspension method inaccordance with the described embodiment.

FIG. 10 is a flow diagram that describes steps in a reinstatement methodin accordance with the described embodiment.

DETAILED DESCRIPTION

Exemplary Operating Environment

FIG. 1 shows but one example of a computer 130 that can be used toimplement the described embodiments.

Computer 130 includes one or more processors or processing units 132, asystem memory 134, and a bus 136 that couples various system componentsincluding the system memory 134 to processors 132. The bus 136represents one or more of any of several types of bus structures,including a memory bus or memory controller, a peripheral bus, anaccelerated graphics port, and a processor or local bus using any of avariety of bus architectures. The system memory 134 includes read onlymemory (ROM) 138 and random access memory (RAM) 140. A basicinput/output system (BIOS) 142, containing the basic routines that helpto transfer information between elements within computer 130, such asduring start-up, is stored in ROM 138.

Computer 130 further includes a hard disk drive 144 for reading from andwriting to a hard disk (not shown), a magnetic disk drive 146 forreading from and writing to a removable magnetic disk 148, and anoptical disk drive 150 for reading from or writing to a removableoptical disk 152 such as a CD ROM or other optical media. The hard diskdrive 144, magnetic disk drive 146, and optical disk drive 150 areconnected to the bus 136 by an SCSI interface 154 or some otherappropriate interface. The drives and their associated computer-readablemedia provide nonvolatile storage of computer-readable instructions,data structures, program modules and other data for computer 130.Although the exemplary environment described herein employs a hard disk,a removable magnetic disk 148 and a removable optical disk 152, itshould be appreciated by those skilled in the art that other types ofcomputer-readable media which can store data that is accessible by acomputer, such as magnetic cassettes, flash memory cards, digital videodisks, random access memories (RAMs), read only memories (ROMs), and thelike, may also be used in the exemplary operating environment.

A number of program modules may be stored on the hard disk 144, magneticdisk 148, optical disk 152, ROM 138, or RAM 140, including an operatingsystem 158, one or more application programs 160, other program modules162 (such as one or more image synthesizing programs), and program data164. A user may enter commands and information into computer 130 throughinput devices such as a keyboard 166 and a pointing device 168. Otherinput devices (not shown) may include a microphone, joystick, game pad,satellite dish, scanner, or the like. The input devices enable images tobe digitized in a conventional manner, and used in accordance with thedescribed embodiment. These and other input devices are connected to theprocessing unit 132 through an interface 170 that is coupled to the bus136. A monitor 172 or other type of display device is also connected tothe bus 136 via an interface, such as a video adapter 174. In additionto the monitor, personal computers typically include other peripheraloutput devices (not shown) such as speakers and printers.

Computer 130 commonly operates in a networked environment using logicalconnections to one or more remote computers, such as a remote computer176. The remote computer 176 may be another personal computer, a server,a router, a network PC, a peer device or other common network node, andtypically includes many or all of the elements described above relativeto computer 130, although only a memory storage device 178 has beenillustrated in FIG. 1. The logical connections depicted in FIG. 1include a local area network (LAN) 180 and a wide area network (WAN)182. Such networking environments are commonplace in offices,enterprise-wide computer networks, intranets, and the Internet.

When used in a LAN networking environment, computer 130 is connected tothe local network 180 through a network interface or adapter 184. Whenused in a WAN networking environment, computer 130 typically includes amodem 186 or other means for establishing communications over the widearea network 182, such as the Internet. The modem 186, which may beinternal or external, is connected to the bus 136 via a serial portinterface 156. In a networked environment, program modules depictedrelative to the personal computer 130, or portions thereof, may bestored in the remote memory storage device. It will be appreciated thatthe network connections shown are exemplary and other means ofestablishing a communications link between the computers may be used.

Generally, the data processors of computer 130 are programmed by meansof instructions stored at different times in the variouscomputer-readable storage media of the computer. Programs and operatingsystems are typically distributed, for example, on floppy disks orCD-ROMs. From there, they are installed or loaded into the secondarymemory of a computer. At execution, they are loaded at least partiallyinto the computer's primary electronic memory. The invention describedherein includes these and other various types of computer-readablestorage media when such media contain instructions or programs forimplementing the steps described below in conjunction with amicroprocessor or other data processor. The invention also includes thecomputer itself when programmed according to the methods and techniquesdescribed below.

For purposes of illustration, programs and other executable programcomponents such as the operating system are illustrated herein asdiscrete blocks, although it is recognized that such programs andcomponents reside at various times in different storage components ofthe computer, and are executed by the data processor(s) of the computer.

Exemplary Handle Administration System

FIG. 2 is a high level diagram that shows a handle administration systemthat includes a handle administrator 200. The handle administrator 200can be part of a resource or access manager that is not specificallyshown. The handle administrator can be implemented in any suitablehardware, software, firmware or combination thereof. A plurality ofdifferent agents 202, 204, and 206 are provided and are consumers ofresources 208, 210, and 212. The agents are typically software modules,such as dynamic link libraries (DLLs), that require access to theresources. Resources 208, 210, and 212 can be any resources for whichhandles are typically used. Exemplary resources include files, datastructures, or objects that are manipulated by the software modules. Theagents 202-206 may require access (either sole or shared) to one or allof the resources.

Handle administrator 200 generates and validates handles to provide tothe agents when the agents desire access to a resource. The handleadministrator 200 uses the handles to efficiently manage access to theresources 208, 210, and 212. Typically, the handle administrator uses ahandle database to manage various handles that can be used to accessresources. To issue a handle, the handle administrator typicallyreceives a call from a resource manager that includes a pointer to aresource. The handle administrator places the resource pointer in thehandle database and associates a handle with the resource pointer. Thehandle administrator then returns the handle to the resource manager.Thereafter, the handle is used to access the resource pointer which, ifvalid, can be used to access the resource. When a particular resource isaccessed by an agent, the agent presents the handle to the resourcemanager or handle administrator. The handle administrator ensures thatthe handle is still valid and if so, dereferences the handle to obtainthe associated resource pointer for the agent to use in accessing theresource. If the handle is invalid, e.g. the associated resource hasbeen removed, then the handle administrator can take the appropriatesteps to ensure that the agent is notified. This might involve returninga null pointer to the agent.

Advantageously, the described handle administrator can suspend handles.When a handle is suspended, its state is changed from that of “assigned”to that of “suspended”. A suspended handle can be considered as atentatively released handle. A tentatively released handle is capable ofbeing reinstated to an assigned state so that it can be validlydereferenced into a pointer to the same resource. When a handle is inthe suspended state, it may still be associated with its resource but isincapable of being dereferenced into a pointer to that resource. Theresult is that any agent that requests access to a resource using asuspended handle is not given access to that resource. Once, however, asuspended handle is reinstated, agents can access the associatedresource using the same handle as before.

Suspended State Handle System

FIG. 3 is a state diagram that describes each of three states that ahandle can have in accordance with the described embodiment. The handlestates are managed by the handle administrator 200 (FIG. 2). Transitionsbetween the states are accomplished by software routines that cause thehandle administrator to manipulate a handle database that maintains atable of the handles. The illustrated states include an unassigned state300, an assigned state 302, and a suspended state 304. The handleadministrator is configured to assign, release, dereference, suspend,and reinstate handles that are associated with various resources.

When a handle is in the unassigned state 300, it can be placed into theassigned state 302 by an assign routine that assigns it to a particularresource and associates a pointer to that resource with the handle. Thehandle can then be provided to any agents that desire to access theassociated resource. When a handle is in the assigned state 302, it canbe placed into the unassigned state 300 by a release routine that marksthe handle as invalid so that it can no longer be dereferenced to obtaina resource pointer. Advantageously, when a handle is in the assignedstate 302 it can be placed into the suspended state 304 by a suspendroutine. In the suspended state 304, a handle can be thought of as beingtentatively released. That is, when a handle is suspended, it can stillbe bound to a particular resource, but it cannot be validly dereferencedinto a pointer to that resource. Thus, any agents that present a handleto the handle administrator when the handle is in the suspended statewill not receive a pointer to the associated resource. A handle can bereturned to the assigned state 302 from the suspended state 304 by areinstate routine. A handle that is in the suspended state 304 can beplaced into the unassigned state 300 through a release routine.

Advantages of having a suspended state for handles include the supportof a two-phase commit operation. A two-phase commit operation is usefulin the following context. Assume that there are a number of agents thathold handles to various resources, such that different agents may holddifferent handles to the same resource. Assume also that a managerialcomponent desires to eliminate a handle to a particular resource becausethat resource might not be further needed. An agent can be requested torelease one of its handles, but if the agent is still using theindicated handle or resource, the agent will reject the request and notrelease the handle. Having the suspended state 304 enables a pluralityof different agents to be requested to release their handles in a singleatomic action. This means that either all of the agents will releasetheir handles if the handles are not being used by any of the agents.Alternately, none of the agents will release their handles if any one ofthe agents is still using its handle. This result is achieved by atwo-phase commit operation.

Two-Phase Commit Operation

FIG. 4 shows a flow diagram that describes steps in an exemplarytwo-phase commit operation. The goal of this operation is to have allagents release a set of handles in a single atomic action. Step 400requests each agent to suspend a particular handle. This step can beimplemented by a managerial component calling multiple different agents.Each agent responds to the request by examining its handles to see ifthe particular handle is in use. If the particular handle is in use, theagent refuses to suspend the particular handle and notifies themanagerial component of its refusal. If the particular handle is not inuse, the agent calls the handle administrator 200 or resource manager tosuspend the particular handle, and the agent notifies the managerialcomponent that it complied with the suspension request. Step 402determines whether the particular handles have been suspended by eachand every agent. If all of the agents have successfully suspended theirhandles, step 404 orders each agent to release its particular handle.The managerial component can be certain that all agents are able tocomply with this order, because all agents have successfully suspendedtheir particular handles, so those particular handles are guaranteed notto be in use. Each agent responds to the order by calling the handleadministrator 200 or resource manager to release its particular handle,at which time it becomes unassigned. When a handle is unassigned, it isavailable for assignment to other resources. If, on the other hand, anyof the agents reports back that it cannot or will not suspend itsparticular handle, then step 406 reinstates all of the particularhandles to the assigned state.

Exemplary Implementations

There are likely many ways to implement the above-described suspendedstate in various handle administration systems. The discussion belowdescribes but two ways that this can be done. The two examples givenbelow are given for exemplary purposes only and are not intended tolimit the scope of the claimed subject matter. The first-describedimplementation makes use of a modified handle database structure, whilethe second-described implementation can make use of an existing handledatabase structure.

Use of Suspended Flag

FIG. 5 shows a table 500 that describes an exemplary data structurecalled a handle record. An array of these data structures is resident ona computer-readable medium and is used by the handle administrator tomanage handles. Each of the handle records describes one particularhandle in the handle record array.

Each handle record includes three fields 502 (handle), 504 (source) and506 (suspended). Field 502 is a data item of type Handle that holds thevalue of the handle described by the record. Field 504 is a data item oftype Resource* (pointer to Resource) that points to the resourceassociated with the handle. Field 506 is a data item of type bool(Boolean flag) that indicates whether the handle has been placed into asuspended state. This flag can then be checked, for example, by thedereference routine to ensure that the handle has not been suspendedbefore dereferencing the handle into a pointer for a resource.

FIG. 6 shows an exemplary elementary handle database 600 that includesan array of four handle records. Each record is identified by a serialindex 602, and each record contains the three fields described in table500: handle 604, resource 606, and suspended 608. The serial index 602indicates the index value or database location for a particular handlerecord. The handle field 604 holds a handle value for a particularhandle record. The resource field 606 holds a pointer value for aparticular resource that is associated with the handle value, and thesuspended field 608 holds a value that indicates whether a particularassociated handle has been suspended. In some systems, when the handledatabase is initialized, the handle values are set equal to the index ofthat record and the resource pointer is set to a null value.Additionally, the value in the suspended column can be set to an initialvalue. In the present example, there are four handle records in thehandle database. The records are numbered 0-3. The handle values are setequal to the index values. In this particular example, the handlecorresponding to the first index location is assigned to resource “A”,the handle corresponding to the second index location is assigned toresource “B”, the handle corresponding to the third index location isassigned to resource “C”, and the handle corresponding to the fourthindex location is assigned to resource “D”. The handle in the fourthrecord has been suspended.

When an agent presents a handle, i.e. handle value, to the handleadministrator 200 (FIG. 2) to access a resource, the handleadministrator takes the handle and determines whether the handle isvalid. In this example, the handle administrator first ascertains thelocation of the pertinent handle record in the handle database. In thiscase, assume that an agent presents a handle value of 0 to the handleadministrator. The handle administrator then locates the pertinenthandle record—here the handle record corresponding to an index of 0—andchecks to determine whether the handle value that was presented by theagent is valid. The handle administrator also checks to ascertainwhether the handle is suspended. To ascertain the validity of a handleor handle value, the handle administrator might simply compare thehandle value presented by the agent with the handle value that ispresent in the handle field 604 for the handle of interest. If thevalues match, then the handle is valid. To ascertain whether the handleis suspended, the handle administrator can simply check the status ofthe suspended field 608 for the handle record of interest. If the handleis valid and not suspended, then the handle can be dereferenced into apointer to the associated resource. Otherwise, the handle is notdereferenced into a pointer.

FIG. 7 shows a flow diagram that describes steps in a dereferencingroutine in accordance with this embodiment. Step 700 receives a handlevalue from one or more agents. Step 702 determines whether the handlevalue is valid. For example, if a handle has been placed into anunassigned state by being released, then it is not a valid handle thatcan be used to access a resource. One way of releasing a handle is toenter a value in the handle value field that is different from thepresent handle value. When the handle administrator compares handlevalues, the comparison is not favorable and thus the handleadministrator will know that the handle presented by the agent isinvalid. If the handle values do not match, thereby indicating aninvalid handle, step 704 can return a null pointer to the agent. It willappreciated that any suitable action can be taken by the handleadministrator when a handle is determined to be invalid. Returning anull pointer constitutes but one suitable action.

Assuming that the handle value is determined to be valid, step 706determines whether the handle has been suspended. In this particularexample, this step is implemented by simply checking the value of thesuspended flag in the handle record that is associated with handle ofinterest. If the flag has a predetermined value that indicates asuspended handle, then step 706 can branch to step 704 and return a nullpointer. In this example, a suspended handle is still associated with aparticular resource—it is just treated as an unassigned handle forpurposes of dereferencing. If, on the other hand, step 706 determinesthat the handle is not suspended, step 708 returns the appropriateresource pointer to the agent.

Although this approach can work well in many handle administrationsystems, there may be times when the additional processing overhead ofchecking the suspended flag, and the additional memory consumed by thesuspended flag in each record can be avoided.

Use of Special Value for Handle Value

In one embodiment, a handle can be indicated as suspended bymanipulating the handle value with a special value. For example, FIG. 8shows an exemplary handle database or table that is similar to thehandle database of FIG. 6, except that it does not contain a suspendedflag field. Here, each of the handles that correspond to index entries0-3 are assigned to respective resources A-D. Each of the handle valuesfor index entries 0-2 have been initialized to the value of the index.Notice that the handle value for index value 3 is (3+2¹⁰). This handlevalue was formerly equal to 3 (i.e. the index value) before the handlewas suspended. This special value now indicates that the handle thatcorresponds to index value 3 is suspended. In this particular example, ahandle is suspended by adding 2¹⁰ to the original handle value. When ahandle is suspended, in this example, it is still associated with aparticular resource. It cannot, however, be dereferenced into a resourcepointer for that resource.

Consider, for example, what happens when an agent presents a handlevalue of 3 to the handle administrator. The handle administrator locatesthe appropriate index value that corresponds to the handle value andthen determines whether the handle value provided by the agent matchesthe handle value in the database. Here, since 3 does not match (3+2¹⁰),the handle administrator treats the handle as if it is unassigned. Thismeans that the agent that presented the handle value does not get accessto the resource that is associated with that handle value. To reinstatea handle, the special value that was added to the handle value is simplysubtracted from the value that occupies the handle value field for thehandle of interest. In the described embodiment, the particular handlevalue manipulations that enable a handle to be suspended and reinstatedare addition and subtraction respectively. It is to be understood thatother handle value manipulations could take place without departing fromthe spirit and scope of the claimed subject matter.

In particular implementations, characteristics of the special value thatis used to indicate that a handle is suspended include that the valueshould be a value that is larger than the table size of the index tableor handle database (in this example the table size is 4). This valueshould also take into account the fact that some handle databases cangrow and shrink in size over the course of time. An exemplary handledatabase that does just that is described in U.S. application Ser. No.09/103334, entitled “Generation and Validation of Reference Handles,filed on Jun. 23, 1998, which is assigned to the assignee of thisapplication, the disclosure of which is incorporated by referenceherein. In addition, the special value should be a fixed value so thatthe handle can be reinstated through a simple procedure such as asubtraction operation described above. In this particular example, ahandle can be reinstated by simply subtracting 2¹⁰ from the value nowheld in the handle value field to yield the original handle value of 3.In addition, in some handle administration systems it is particularadvantageous to use a power of 2 as the special value for internalpurposes.

FIG. 9 shows a flow diagram that describes steps in a handle suspensionmethod in accordance with the described embodiment. Step 900 determinesthat a particular handle is to be suspended. This might be done when aresource with which the handle is associated is desired to be eliminatedas mentioned above. Step 902 suspends the handle by adding a value tothe handle value that is contained in the handle database for the handleof interest.

FIG. 10 shows a flow diagram that describes steps in a handlereinstatement method in accordance with the described embodiment. Step1000 determines that a particular handle is to be reinstated. One reasonfor reinstating a handle might be the failure of the first phase of atwo-phase commit operation. Step 1002 reinstates the handle bysubtracting the value (i.e. 2¹⁰) that was originally added to the handlevalue to suspend it. This returns the handle value to its original valueand places it in an assigned state.

The above described process greatly facilitates the manner in whichhandles can be suspended and reinstated. This approach is particularlyuseful in the context of a specific handle administration system that isdescribed in U.S. patent application Ser. No. 09/103334. For the sake ofbrevity, the specific operation of that system is not described herein.In the context of the handle administration system disclosed in thereferenced application, the special value that is utilized to suspendhandle is known as the handle range step. The handle range step is aspecial large value that is a power of 2. This value is typically usedin the described system to automatically revoke handles in a system-widemanner. The described system periodically revokes all handles whosevalues are greater than or equal to a value known as the handle base andless than the handle base plus the handle range step. By using thehandle range step as the special value added to a handle value toindicate suspension, several important properties of the describedsystem are preserved: 1) The assign, release, expand, and contractprocedures will treat the record as though it is assigned, so the recordwill be preserved for possible future reinstatement. 2) The dereferenceprocedure will treat the record as though it is invalid, so it willrefuse to dereference the handle to a pointer to the associatedresource. 3) The expand and contract routines will properly locate thehandle record when the database is expanded and contracted. 4) Thehandle revocation routine will revoke suspended handles at approximatelythe same time as it would revoke the handle if it were not suspended.The use of a handle range step will be understood by those familiar withthe described handle administration system and is not discussed indetail here. In connection with using the handle range step to suspendhandles in the referenced disclosure, a few modifications of that systemshould be implemented. First, in the referenced handle administrationsystem, the handle base is initialized to 0. In the present case, thehandle base should be initialized to the record array size minus thehandle range step. Additionally, in the referenced handle administrationsystem there is a process for revoking so-called ancient handles. There,a revocation range is described as a range from the handle base to thehandle base plus the handle range step. In the present context, therevocation range is redefined as the range from the handle base to thehandle base plus two times the handle range step.

Additionally, in the referenced handle administration system, therelease routine checks to determine whether the handle value that ispassed in by the agent matches the handle value in the handle record. Ifit does not, then the release operation is aborted since the handlepassed to the release routine is not currently assigned. In the presentcontext, the release routine checks whether the handle value that ispassed to the release routine matches the handle value in the handlerecord (indicating an assigned handle) or whether it matches the handlevalue in the handle record minus the handle range step (indicating asuspended handle). If either of the values match the value passed to therelease routine, then the handle can be released.

CONCLUSION

The described embodiments advantageously provide for a three-statehandle administration system. The suspended state enables handles to betentatively released from the assigned state. Suspended handles can bereinstated to their previously assigned state or permanently releasedinto the unassigned state. Having this flexibility greatly facilitatesthe use of handle administration systems. For example, using the abovedescribed suspended state, two-phase commit operations can now beimplemented whereas before, with other handle administration systems,they could not. Other advantages will be apparent to those of skill inthe art.

Although the invention has been described in language specific tostructural features and/or methodological steps, it is to be understoodthat the invention defined in the appended claims is not necessarilylimited to the specific features or steps described. Rather, thespecific features and steps are disclosed as preferred forms ofimplementing the claimed invention.

1. A resource management system comprising: at least one computerreadable storage media; and one or more handle records resident on themedia, each record having fields, one of the fields being configured toprovide indicia of whether a handle is in a state other than an assignedstate and an unassigned state, wherein the other state comprises asuspended state in which a handle is associated with a particularresource, but cannot be dereferenced to obtain a pointer to thatresource.
 2. A data structure embodied on a computer-readable storagemedium for use in managing resources, the data structure comprising: afirst portion that is associated with a pointer to a resource; and asecond portion that is associated with a suspended handle state, whereinthe suspended handle state indicates a handle that is associated with aparticular resource but which cannot be dereferenced to obtain a pointerto that resource.
 3. The data structure of claim 2, wherein the secondportion is configured to hold a value that indicates that a handle issuspended.
 4. The data structure of claim 3 further comprising a handleadministrator that is configured to use said data structure to managehandles for the resources, the handle administrator being configured todereference handles into pointers to resources with which the handlesare associated.
 5. The data structure of claim 4, wherein the handleadministrator is configured to receive a handle and determine whetherthe handle is valid and not suspended before dereferencing it into apointer.
 6. A computing device comprising: one or more processors; atleast one computer readable media; one or more handle records residenton the media, each record having fields, one of the fields beingconfigured to provide indicia of whether a handle is in a state otherthan an assigned state and an unassigned state, wherein the other statecomprises a suspended state in which a handle can be associated with aparticular resource, but cannot be dereferenced to obtain a pointer tothat resource; computer-readable instructions on the computer-readablemedia which, when executed by the one or more processors, cause the oneor more processors to utilize the one or more handle records to managehandle-associated resources.
 7. A computing device comprising: one ormore processors; at least one computer readable media; a data structureembodied on the computer readable media, the data structure comprising:a first portion that is associated with a pointer to a resource; and asecond portion that is associated with a suspended handle state, whereinthe suspended handle state indicates a handle that is associated with aparticular resource but which cannot be dereferenced to obtain a pointerto that resource; computer-readable instructions on thecomputer-readable media which, when executed by the one or moreprocessors, cause the one or more processors to utilize the datastructure to manage resources.
 8. The computing device of claim 7,wherein the second portion is configured to hold a value that indicatesthat a handle is suspended.
 9. The computing device of claim 7 furthercomprising a handle administrator that is configured to use said datastructure to manage handles for the resources, the handle administratorbeing configured to dereference handles into pointers to resources withwhich the handles are associated.
 10. The computing device of claim 9,wherein the handle administrator is configured to receive a handle anddetermine whether the handle is valid and not suspended beforedereferencing it into a pointer.